CREATE TABLE [dbo].[PlanTypeWork]
(
[Ik_PlanTypeWork] [int] NOT NULL IDENTITY(1, 1),
[Ik_TypeEvent] [int] NOT NULL,
[iK_vid_zanyat] [int] NOT NULL,
[Ik_next] [int] NULL
)
GO
ALTER TABLE [dbo].[PlanTypeWork] ADD CONSTRAINT [PlanTypeWorkPrimary] PRIMARY KEY CLUSTERED  ([Ik_PlanTypeWork])
GO
CREATE NONCLUSTERED INDEX [idx_Ik_next] ON [dbo].[PlanTypeWork] ([Ik_next])
GO
ALTER TABLE [dbo].[PlanTypeWork] ADD CONSTRAINT [PlanTypeWorkPlanTypeWorkForeign] FOREIGN KEY ([Ik_next]) REFERENCES [dbo].[PlanTypeWork] ([Ik_PlanTypeWork])
GO
ALTER TABLE [dbo].[PlanTypeWork] ADD CONSTRAINT [PlanTypeWorkTypeEventForeign] FOREIGN KEY ([Ik_TypeEvent]) REFERENCES [dbo].[TypeEvent] ([Ik_TypeEvent])
GO
ALTER TABLE [dbo].[PlanTypeWork] ADD CONSTRAINT [PlanTypeWorkTypeWorkForeign] FOREIGN KEY ([iK_vid_zanyat]) REFERENCES [dbo].[vid_zaniat] ([iK_vid_zanyat])
GO
